﻿using System.Collections.Generic;

namespace Microsoft.WowAddonStudio.TocEditor
{
	public static class TocTagName
	{
		// Client recognized tags
		[ExcludeTag] public const string Interface = "Interface";
		[ExcludeTag] public const string Title = "Title";
		[ExcludeTag] public const string Notes = "Notes";
		public const string Dependencies = "Dependencies";
		public const string OptionalDeps = "OptionalDeps";
		public const string LoadOnDemand = "LoadOnDemand";
		public const string LoadWith = "LoadWith";
		public const string LoadManagers = "LoadManagers";
		public const string SavedVariables = "SavedVariables";
		public const string DefaultState = "DefaultState ";
		public const string Secure = "Secure";

		// AddOn metadata tags
		[ExcludeTag] public const string Author = "Author";
		[ExcludeTag] public const string Version = "Version";

		// X- metadata tags and variations
		public const string XRevision = "X-Revision";
		public const string XDate = "X-Date";

		public const string Email = "eMail";
		public const string XEmail = "X-Email";

		public const string XWebsite = "X-Website";
		public const string Url = "URL";

		public const string XFeedback = "X-Feedback";
		public const string XLocalizations = "X-Localizations";
		public const string XCompatibleLocales = "X-CompatibleLocales";
		public const string XEmbeds = "X-Embeds";
		public const string XCategory = "X-Category";

		/// <summary>
		/// Gets the common tag names.
		/// </summary>
		/// <returns></returns>
		public static IEnumerable<string> GetCommonTagNames()
		{
			foreach (var fieldInfo in typeof (TocTagName).GetFields())
			{
				if (!fieldInfo.IsLiteral)
					continue;

				if (fieldInfo.GetCustomAttributes(typeof (ExcludeTagAttribute), false).Length > 0)
					continue;

				var value = fieldInfo.GetRawConstantValue();

				if (value is string)
					yield return (string) value;
			}
		}
	}
}